gempy.core.data.Grid

class gempy.core.data.Grid(extent=None, resolution=None)[source]

Class to generate grids.

This class is used to create points to evaluate the geological model. This class serves a container which transmits the XYZ coordinates to the interpolator. There are several type of grid objects feeding into the Grid class

Parameters:

**kwargs – See below

Keyword Arguments:
  • regular (gempy.core.grid_modules.grid_types.RegularGrid) – [s0]

  • custom (gempy.core.grid_modules.grid_types.CustomGrid) – [s1]

  • topography (gempy.core.grid_modules.grid_types.Topography) – [s2]

  • sections (gempy.core.grid_modules.grid_types.Sections) – [s3]

  • gravity (gempy.core.grid_modules.grid_types.Gravity) –

values

coordinates where the model is going to be evaluated. This is the coordinates concatenation of all active grids.

Type:

np.ndarray

values_r

rescaled coordinates where the model is going to be evaluated

Type:

np.ndarray

length

I a array which contain the slicing index for each grid type in order. The first element will be 0, the second the length of the regular grid; the third custom and so on. This can be used to slice the solutions correspondent to each of the grids

Type:

np.ndarray

grid_types

names of the current grids of GemPy

Type:

np.ndarray[str]

active_grids_bool

boolean array which controls which type of grid is going to be computed and hence on the property values.

Type:

np.ndarray[bool]

regular_grid
Type:

gempy.core.grid_modules.grid_types.RegularGrid

custom_grid
Type:

gempy.core.grid_modules.grid_types.CustomGrid

topography
Type:

gempy.core.grid_modules.grid_types.Topography

sections
Type:

gempy.core.grid_modules.grid_types.Sections

gravity_grid
Type:

gempy.core.grid_modules.grid_types.Gravity

Examples using gempy.core.data.Grid

2.1 Forward Gravity: Simple example

2.1 Forward Gravity: Simple example

Methods

__init__([extent, resolution])

create_centered_grid(centers, radius[, ...])

Initialize gravity grid.

create_custom_grid_(custom_grid)

Set a new regular grid and activate it.

create_regular_grid([extent, resolution, ...])

Set a new regular grid and activate it.

create_section_grid(section_dict)

create_topography_([source])

Create a topography grid and activate it.

deactivate_all_grids()

Deactivates the active grids array :return:

get_grid(grid_name)

get_grid_args(grid_name)

get_section_args(section_name)

set_active(grid_name)

Set active a given or several grids :param grid_name: :type grid_name: str, list

set_inactive(grid_name)

update_grid_values()

Copy XYZ coordinates from each specific grid to Grid.values for those which are active.

Attributes

active_grids

__init__(extent=None, resolution=None)[source]
create_regular_grid(extent=None, resolution=None, set_active=True, *args, **kwargs)[source]

Set a new regular grid and activate it.

Parameters:
  • extent (np.ndarray) – [x_min, x_max, y_min, y_max, z_min, z_max]

  • resolution (np.ndarray) – [nx, ny, nz]

RegularGrid Docs

create_custom_grid_(custom_grid: ndarray)[source]

Set a new regular grid and activate it.

Parameters:

custom_grid (np.array) – [s0]

create_topography_(source='random', **kwargs)[source]

Create a topography grid and activate it.

Parameters:

source

  • ‘gdal’: Load topography from a raster file.

  • ’random’: Generate random topography (based on a fractal grid).

  • ’saved’: Load topography that was saved with the topography.save() function. This is useful after loading and saving a heavy raster file with gdal once or after saving a random topography with the save() function. This .npy file can then be set as topography.

Keyword Arguments:
  • 'gdal' (source =) –

  • 'random' (source =) –

    • fd: fractal dimension, defaults to 2.0

    • d_z: maximum height difference. If none, last 20% of the model in z direction

    • extent: extent in xy direction. If none, geo_model.grid.extent

    • resolution: desired resolution of the topography array. If none, geo_model.grid.resoution

  • 'saved' (source =) –

    • filepath: path to the .npy file that was created using the topography.save() function

Returns:

class:gempy.core.data.Topography

create_centered_grid(centers, radius, resolution=None)[source]

Initialize gravity grid. Deactivate the rest of the grids

deactivate_all_grids()[source]

Deactivates the active grids array :return:

set_active(grid_name: str | ndarray)[source]

Set active a given or several grids :param grid_name: :type grid_name: str, list

update_grid_values()[source]

Copy XYZ coordinates from each specific grid to Grid.values for those which are active.

Returns:

values